using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerDashState : PlayerState
{
    public PlayerDashState(Player player, StateMachine stateMachine, string animName) : base(player, stateMachine, animName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        player.skill.clone.CreateCloneOnDashStart();
        stateTimer = player.dashDuration;
        player.SetVelocity(player.dashSpeed * player.dashDir, 0);

    }

    public override void Exit()
    {
        base.Exit();
        player.SetVelocity(0, rb.velocity.y);
        player.skill.clone.CreateCloneOnDashEnd();
    }

    public override void Update()
    {
        base.Update();

        if (!player.IsGroundDetected() && player.IsWallDetected())
            stateMachine.ChangeState(player.wallSlide);


        if (stateTimer < 0)
        {
            stateMachine.ChangeState(player.idleState);
        }
    }


}
